import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
  ],
  server: {
    proxy: {
      "/api": {
        // target: "http://localhost:10010",//项目主配置文件 要运行 先在本地开放后端端口（伏笔）
        target: "http://8.138.82.140:10010",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      },
      // "/api":"http://localhost:5050"
    },
  },
  resolve: {
    extensions: [".js", ".ts"],
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    },
  }
})
